﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using VTS.BLL;
using VTS.Common;

public partial class admin_Login : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        // if current user has loggedin then redirect to home page
        if (Utility.HasLoggedIn())
        {
            Response.Redirect(Constants.DEFAULT_PAGE);
        }        
    }
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        QuanTriBLL bllQuanTri = new QuanTriBLL();

        if (bllQuanTri.CheckLogin(txtPassword.Text, txtPassword.Text))
        {
            Session[Constants.SESSION_LOGGEDIN] = txtUserName.Text;
            Response.Redirect(Constants.DEFAULT_PAGE);
        }
        else
        {
            lblMessage.Visible = true;
            lblMessage.Text = "Tên truy cập hoặc mật khẩu không chính xác";
        }
    }
}